//结构体的定义与使用
#include<iostream>
#include<string.h>

using namespace std;
//1.创建学生类型数据
struct Student
{
	string name;
	int age;
	int score;
}s3;

int main()
{
	//2.通过数据类型创建具体学生
	//2.1 struct Student s1;
	Student s1;
	s1.name = "张三";
	s1.age  = 17;
	s1.score = 100;
	cout << "姓名:" << s1.name << endl;
	cout << "年龄:" << s1.age << endl;
	cout << "成绩:" << s1.score << endl;
	cout << endl;
	//2.2 struct Stuaent s2 = { ... };
	struct Student s2 = { "李四",20,60 };
	cout << "姓名:" << s2.name << endl;
	cout << "年龄:" << s2.age << endl;
	cout << "成绩:" << s2.score << endl;
	cout << endl;
	//2.3在定义结构体时创建结构体变量
	s3.name = "王五";
	s3.age = 21;
	s3.score = 80;
	cout << "姓名:" << s3.name << endl;
	cout << "年龄:" << s3.age << endl;
	cout << "成绩:" << s3.score << endl;
	cout << endl;
	system("pause");
	return 0;
}
